<?php

class WebUser extends CWebUser {

	protected function beforeLogin($id, $states, $fromCookie) {
		return true;
	}

	protected function afterLogin($fromCookie) {
		$log = new UserLoginLog();
		$log->userId = $this->getId();
		$log->ip = Yii::app()->request->userHostAddress;
		$log->loginTime = new CDbExpression('NOW()');
		$log->fromCookie = $fromCookie;
		$log->save();
	}
}
